<?php
function box ($string) {
 return '<div class="box">'.$string.'</div>';
}

function show_table ($query, $type) {

 $output ='<table class="list"><tr>';
 switch ($type) {
 	case "studies":
		$output.="<td>Studiengang-Name</td><td>Abfragen</td>";
		break;
 	case "modules":
		$output.="<td>Modul-Name</td><td>Abfragen</td>";
		break;
 }
 $output.="</tr>";

 while ($line = mysql_fetch_object($query)) {
	$output.="<tr><td>".$line->title."</td>";
	$output.="<td>";
if ($type=="studies") $output.='<a href="index.php?show=modules&study='.$line->id.'">[Module anzeigen]</a>';
if ($type=="modules") $output.='<a href="index.php?show=module&module='.$line->id.'">[Details anzeigen]</a>';
	$output.="</td>";
	$output.="</tr>";
 }
 $output.="</table>";
 return $output;
}

function title ($id,$table) {
 return mysql_fetch_object(mysql_query("SELECT title from ".$table." where id=".$id))->title;
}

?>